﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Actuals.Business;
using Actuals.CoreDomain;
using Actuals.CoreDomain.Business;

namespace Actuals
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                IBusinessEmployee businessEmployee = new BusinessEmployee();
                IList<IEmployee> employees = businessEmployee.GetEmployees();
                ddlLoginid.DataSource = employees;
                ddlLoginid.DataValueField = "Id";
                ddlLoginid.DataTextField = "NickName";
                ddlLoginid.DataBind();
                ddlLoginid.Items.Insert(0, "Select");

            }
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Session["EmployeeId"] = ddlLoginid.SelectedValue.Trim();
            //Session["ProjectId"] = ddlProject.SelectedValue.Trim();
            //Session["ReleaseId"] = ddlRelease.SelectedValue.Trim();
            IBusinessEmployee businessEmployee = new BusinessEmployee();
            IEmployee employee = businessEmployee.GetEmployee(int.Parse(ddlLoginid.SelectedValue.Trim()));
            Session["RoleId"] = employee.RoleId;
            ClientScript.RegisterClientScriptBlock(this.GetType(), "setMenu", "parent.setMenu('Emp');", true);

        }

        protected void ddlLoginid_OnSelectedIndexChanged(object sender, EventArgs e)
        {
           // FillProjects(ddlLoginid.SelectedValue);
        }

       

    }
}